package school.valon.persistence.dao.impl;

import school.valon.persistence.dao.SchoolDao;
import school.valon.persistence.dao.base.impl.GenericDaoImpl;
import school.valon.persistence.pojo.School;
import school.valon.persistence.pojo.SchoolPolicy;

public class SchoolDaoImpl extends GenericDaoImpl<School, Integer> implements SchoolDao {

	public SchoolPolicy findSchoolPolicy(Integer schoolPolicyId) {
		return em.find(SchoolPolicy.class, schoolPolicyId);
	}

	public SchoolPolicy createSchoolPolicy(SchoolPolicy schoolPolicy) {
		em.persist(schoolPolicy);
		return schoolPolicy;
	}

	public SchoolPolicy updateSchoolPolicy(SchoolPolicy schoolPolicy) {
		return em.merge(schoolPolicy);
	}

	public void deleteSchoolPolicy(Integer schoolPolicyId) {
    	em.createNamedQuery("SchoolPolicy.deleteById")
			.setParameter("P1", schoolPolicyId).executeUpdate();
	}
}

